<!doctype html>
<html>

<head>
    <meta charset="utf-8">
    <title>统一支付</title>
    <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0">
    <link rel="stylesheet" href="/lobsteruiframe/weui/css/weui.css" />
    <link rel="stylesheet" href="/lobsteruiframe/weui/css/weuix.css" />
    <script src="/lobsteruiframe/weui/js/zepto.min.js"></script>
    <script src="/lobsteruiframe/weui/js/zepto.weui.js"></script>
    <script src="/lobsteruiframe/weui/js/swipe.js"></script>
    <script src="/lobsteruiframe/weui/js/macy.js"></script>
    <script src="/jslib/lobster.js"></script>
    <script src="/jslib/template-web.js"></script>
</head>


<body>
    <div class="weui-msg" id="s1">
        <div class="weui-msg__icon-area"><i class="weui-icon-success weui-icon_msg"></i></div>
        <div class="weui-msg__text-area">
            <h2 class="weui-msg__title">支付成功</h2>
            <p class="weui-msg__desc" id="desc">您的预约挂号成功</p>
        </div>
        <div class="weui-msg__opr-area">
            <p class="weui-btn-area">
                <!-- <a href="javascript:;" id="togo" class="weui-btn weui-btn_primary">查看预约</a> -->
                <a href="javascript:;" id="toshouye" class="weui-btn weui-btn_default">返回首页</a>
            </p>
        </div>
        <div class="weui-msg__extra-area">

        </div>
    </div>
</body>
<script>

    lobsterh5.main({
        data: {
            orderNo: lobsterh5.GetUrlParam("orderNo"),
            orderInfo: {},
        },
        //初始化页面
        pageload: function () {
            this.initevent();
            this.getorder().then(res => {
                $.hideLoading();
                this.data.orderInfo = res;
                if (this.data.orderInfo.OrderType == 1) {
                    $("#desc").text("您的预约挂号成功");
                    $("#togo").text("查看预约");
                } else if (this.data.orderInfo.OrderType == 2) {
                    $("#desc").text("您的自助缴费成功");
                    $("#togo").text("查看缴费");
                } else if (this.data.orderInfo.OrderType == 3) {
                    $("#desc").text("您的订单支付成功");
                    $("#togo").text("查看订单");
                }
            });
        },

        //初始化事件
        initevent: function () {
            var self = this;
            $("#togo").click(function () {
                if (self.data.orderInfo.OrderType == 1) {
                    // alert("预约挂号")
                    location.href = "/weuiapp/3223/register/record.html";
                } else if (self.data.orderInfo.OrderType == 2) {
                    // alert("自助缴费")
                    location.href = "/weuiapp/3223/payrecord/list.html";
                } else if (self.data.orderInfo.OrderType == 3) {
                    location.href = "/weuiapp/10/order/list.html";
                }
            })
            $("#toshouye").click(function () {
                location.href = "/customer/index.html?WorkId="+lobsterh5.GetWorkId();

                // if (self.data.orderInfo.OrderType == 1 || self.data.orderInfo.OrderType == 2)
                //     location.href = "/weuiapp/3223/index.html";
                // else if (self.data.orderInfo.OrderType == 3)
                //     location.href = "/weuiapp/10/index.html"
            })
        },
        getorder: function () {
            $.showLoading("加载中");
            var self = this;
            return new Promise((resolve, reject) => {
                lobsterh5.GETAPI("tsfront.getorder", {
                    orderNo: self.data.orderNo,
                }).then(res => {
                    // alert(res);
                    resolve(res);
                }).catch(res => {
                    reject(res);
                });
            })
        },
    }); 
</script>

</html>